# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=squashfs-tools
pkgver=4.6.1
pkgrel=1
pkgdesc="Tools for squashfs, a highly compressed read-only filesystem for Linux"
url="https://github.com/plougher/squashfs-tools"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	attr-dev
	lz4-dev
	lzo-dev
	xz-dev
	zlib-dev
	zstd-dev
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/plougher/squashfs-tools/archive/$pkgver.tar.gz
	"
options="!check" # no testsuite

# secfixes:
#   4.5-r1:
#     - CVE-2021-41072
#   4.5-r0:
#     - CVE-2021-40153

build() {
	CFLAGS="$CFLAGS -O2 -flto=auto"\
	CPPFLAGS="$CPPFLAGS -O2 -flto=auto" \
		make -C squashfs-tools XZ_SUPPORT=1 LZO_SUPPORT=1 LZ4_SUPPORT=1 ZSTD_SUPPORT=1
}

package() {
	make -C squashfs-tools \
		INSTALL_MANPAGES_DIR="$pkgdir/usr/share/man/man1" \
		INSTALL_PREFIX="$pkgdir/usr" \
		USE_PREBUILT_MANPAGES=y \
		install
}

sha512sums="
10e8a4b1e2327e062aef4f85860e76ebcd7a29e4c19e152ff7edec4a38316982b5bcfde4ab69da6bcb931258d264c2b6cb40cb5f635f9e6f6eba1ed5976267cb  squashfs-tools-4.6.1.tar.gz
"
